<template>
  <div id="app">
    <img alt="Vue logo" src="./assets/logo.png">
    <Student></Student>
    <Student></Student>
    <Student></Student>

    <h1 v-text="msg" ref="title"></h1>
    <button ref="btn" @click="showDom">点我输出上方的DOM元素</button>
    <Student ref="stu"></Student>
  </div>
</template>

<script>
import Student from './components/Student.vue'

export default {
  name: 'App',
  components: {
    Student
  },
  data() {
    return {
      msg: '欢迎学习Vue!!!!!!!!'
    }
  },
  methods: {
    showDom() {
      console.log(this.$refs.title); // 输出真实的DOM元素
      console.log(this.$refs.btn); // 输出真实的DOM元素
      console.log(this.$refs.stu); // School 组件的实例对象（vc）
    }
  },
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
